package ops.model.manager;

import ops.Application;

public class EntityController {

	private ClassManager classManager;
	private CourseManager courseManager;
	private StudentManager studentManager;
	private SubjectManager subjectManager;
	private TermManager termManager;
	private UserManager userManager;
	private TeacherManager teacherManager;
	private SubscriptionManager subscriptionManager;
	
	public static EntityController getInstance() {
		return Application.getInstance().getEntityController();
	}
	
	public EntityController() {
		init();
	}
	
	private void init() {
		classManager = new ClassManager();
		courseManager = new CourseManager();
		studentManager = new StudentManager();
		subjectManager = new SubjectManager();
		termManager = new TermManager();
		userManager = new UserManager();
		teacherManager = new TeacherManager();
		subscriptionManager = new SubscriptionManager();
	}
	
	public void saveAll() {
		classManager.save();
		courseManager.save();
		studentManager.save();
		subjectManager.save();
		termManager.save();
		userManager.save();
		teacherManager.save();
		subscriptionManager.save();
	}

	public ClassManager getClassManager() {
		return classManager;
	}
	
	public CourseManager getCourseManager() {
		return courseManager;
	}
	
	public StudentManager getStudentManager() {
		return studentManager;
	}
	
	public SubjectManager getSubjectManager() {
		return subjectManager;
	}
	
	public TermManager getTermManager() {
		return termManager;
	}
	
	public UserManager getUserManager() {
		return userManager;
	}

	public TeacherManager getTeacherManager() {
		return teacherManager;
	}

	public SubscriptionManager getSubscriptionManager() {
		return subscriptionManager;
	}
}
